const webpack = require('webpack');
const path = require('path');

const vendors = [
  'vue',
  'marked',
  'vue-simplemde',
  'highlight.js',
];

module.exports = {
  output: {
    path: path.resolve(__dirname,'public'),
    filename: '[name].[chunkhash].js',
    libraryTarget: 'var',
    library: '[name]_[chunkhash]',
  },
  entry: {
    vendor: vendors,
  },
  plugins: [
    new webpack.DllPlugin({
      path: path.resolve(__dirname,'public/manifest.json'),
      name: '[name]_[chunkhash]',
      context: path.resolve(__dirname,'public'),
    }),
    new webpack.optimize.CommonsChunkPlugin({
        names: ['vendor', 'manifest']
    })
  ],
};